
class Teacher//类声明
{	//类体
	String name,title,course,research,office;//定义成员变量，类型均为字符串
	Teacher(){}//定义一个无参数的构造方法
	Teacher(String name,String title,String course,String research,String office)//有参数的构造方法
	{
	this.name=name;
	this.title=title;
	this.course=course;
	this.research=research;
	this.office=office;
	}
	public void getTeacher()//读取老师的信息
	{
	System.out.println("姓名:"+name);
	System.out.println("职位:"+title);
	System.out.println("主讲课程:"+course);
	System.out.println("研究方向:"+research);
	System.out.println("办公室:"+office);
	}
	public void setTitle(String title)//更改老师的职位
	{
		this.title=title;
	}
	public void setCourse(String course)//更改老师的课程
	{
		this.course=course;
	}
	public void setResearch(String research)//更改老师的研究方向
	{
		this.research=research;
	}
	public void setOffice(String office)//更改老师的办公室
	{
		this.office=office;
	}
}
public class teacherSet1 {
	public static void main(String args[])
    {
		//声明对象t1
        Teacher t1;
        //使用有参数的构造方将t1实例化
        t1=new Teacher("Chen jianyong","associate professor","English","Marketing","A305");
        //读取t1的信息并输出
        t1.getTeacher();
        //更改老师的信息
        t1.setTitle("professor");
        t1.setCourse("Professional Basic English");
        t1.setResearch("Market forecasting");
        t1.setOffice("A315");
        //输出老师的信息
        System.out.println();//打印空行，作为分隔行
        t1.getTeacher();
    }
}
